package com.link.base.base.report.service;

import com.link.base.base.report.dao.mybatis.mapper.DataMonitoringReportMapper;
import com.link.base.base.report.model.DataMonitoringReport;
import com.link.core.basic.dao.mapper.BasicMapper;
import com.link.core.basic.service.BasicServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;


/**
 * 大数据流程数据监控报表-
 *
 * @author 谢鑫
 * @date 2019/10/17 14:06
 */
@Service
public class DataMonitoringReportServiceImpl extends BasicServiceImpl<DataMonitoringReport> implements DataMonitoringReportService {

    @Resource
    private DataMonitoringReportMapper dataMonitoringReportMapper;

    @Override
    public BasicMapper<DataMonitoringReport> getBasicMapper() {
        return dataMonitoringReportMapper;
    }


    @Override
    public List<DataMonitoringReport> queryNewData() {
        return dataMonitoringReportMapper.queryNewData();
    }

    @Override
    public List<DataMonitoringReport> queryDateData() {
        List<DataMonitoringReport> list = dataMonitoringReportMapper.queryJdData();
        System.out.println(list.size());
        List<DataMonitoringReport> list1 = dataMonitoringReportMapper.queryTmData();
        List<DataMonitoringReport> list2 = dataMonitoringReportMapper.queryLinkData();
        List<DataMonitoringReport> list3 = dataMonitoringReportMapper.queryKfData();
        List<DataMonitoringReport> list4 = new ArrayList<>();
        for (int i = 0; i < 7; i++) {
            DataMonitoringReport dataMonitoringReport = new DataMonitoringReport();
            dataMonitoringReport.setSepDate(list.get(i).getSepDate());
            dataMonitoringReport.setJdData(list.get(i).getDateImp());
            dataMonitoringReport.setTmData(list1.get(i).getDateImp());
            dataMonitoringReport.setLinkData(list2.get(i).getDateImp());
            dataMonitoringReport.setKfData(list3.get(i).getDateImp());
            list4.add(dataMonitoringReport);
        }
        return list4;
    }
}

